package com.duan.service;

import com.duan.mapper.UserMapper;
import com.duan.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    private final UserMapper userMapper; // Springboot官方建议使用final来修饰成员变量，然后通过构造方法来进行注入

    @Autowired
    public UserService(UserMapper userMapper){
        this.userMapper = userMapper;
    }

    /***
     * 登录
     * @param username 用户名
     * @param password 用户密码
     * @return 返回查找结果，类型：User
     */
    public User login(String username, String password){
        return userMapper.selectUserByUsernameAndPassword(username, password);
    }

}
